

from selenium import webdriver

import pytest,os,requests

@pytest.fixture(scope='function')
def getdriver():

    driver = webdriver.Edge()
    #窗口最大化
    driver.maximize_window()
    #隐式等待
    driver.implicitly_wait(10)
    yield driver
    #退出driver
    driver.quit()

@pytest.fixture(scope='function')
def get_token():
    url=os.getenv('weidu_url')+os.getenv('login_url')
    print("登录网址:",url)

    body={
        "email":"1478997572@qq.com",
        "pwd":"eWLPHopE945d2ivttHaQTQ=="
    }
    res=requests.post(url,data=body).json()
    print(res)
    token={
        "userId":str(res['result']['userId']),
        "sessionId":res['result']['sessionId']
    }
    print("获取到的token值:",token)
    yield token
